package com.hdphone.zljutils.inter;

import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;

import java.io.File;
import java.io.FileDescriptor;
import java.io.InputStream;

import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;

/**
 * @author sq
 * @date 2020/10/19
 * @describe
 */
public interface IBitmapUtil {

    /**
     * Bitmap to bytes.
     *
     * @param bitmap The bitmap.
     * @param format The format of bitmap.
     * @return bytes
     */
    byte[] bitmap2Bytes(final Bitmap bitmap, final Bitmap.CompressFormat format);

    /**
     * Bytes to bitmap.
     *
     * @param bytes The bytes.
     * @return bitmap
     */
    Bitmap bytes2Bitmap(final byte[] bytes);

    /**
     * Drawable to bitmap.
     *
     * @param drawable The drawable.
     * @return bitmap
     */
    Bitmap drawable2Bitmap(final Drawable drawable);

    /**
     * Bitmap to drawable.
     *
     * @param bitmap The bitmap.
     * @return drawable
     */
    Drawable bitmap2Drawable(final Bitmap bitmap);

    /**
     * Drawable to bytes.
     *
     * @param drawable The drawable.
     * @param format   The format of bitmap.
     * @return bytes
     */
    byte[] drawable2Bytes(final Drawable drawable, final Bitmap.CompressFormat format);

    /**
     * Bytes to drawable.
     *
     * @param bytes The bytes.
     * @return drawable
     */
    Drawable bytes2Drawable(final byte[] bytes);

    /**
     * View to bitmap.
     *
     * @param view The view.
     * @return bitmap
     */
    Bitmap view2Bitmap(final View view);

    /**
     * Return bitmap.
     *
     * @param file The file.
     * @return bitmap
     */
    Bitmap getBitmap(final File file);

    /**
     * Return bitmap.
     *
     * @param file      The file.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(final File file, final int maxWidth, final int maxHeight);

    /**
     * Return bitmap.
     *
     * @param filePath The path of file.
     * @return bitmap
     */
    Bitmap getBitmap(final String filePath);

    /**
     * Return bitmap.
     *
     * @param filePath  The path of file.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(final String filePath, final int maxWidth, final int maxHeight);

    /**
     * Return bitmap.
     *
     * @param is The input stream.
     * @return bitmap
     */
    Bitmap getBitmap(final InputStream is);

    /**
     * Return bitmap.
     *
     * @param is        The input stream.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(final InputStream is, final int maxWidth, final int maxHeight);

    /**
     * Return bitmap.
     *
     * @param data   The data.
     * @param offset The offset.
     * @return bitmap
     */
    Bitmap getBitmap(final byte[] data, final int offset);

    /**
     * Return bitmap.
     *
     * @param data      The data.
     * @param offset    The offset.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(final byte[] data,
                     final int offset,
                     final int maxWidth,
                     final int maxHeight);

    /**
     * Return bitmap.
     *
     * @param resId The resource id.
     * @return bitmap
     */
    Bitmap getBitmap(@DrawableRes final int resId);

    /**
     * Return bitmap.
     *
     * @param resId     The resource id.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(@DrawableRes final int resId,
                     final int maxWidth,
                     final int maxHeight);

    /**
     * Return bitmap.
     *
     * @param fd The file descriptor.
     * @return bitmap
     */
    Bitmap getBitmap(final FileDescriptor fd);

    /**
     * Return bitmap.
     *
     * @param fd        The file descriptor
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return bitmap
     */
    Bitmap getBitmap(final FileDescriptor fd,
                     final int maxWidth,
                     final int maxHeight);

    /**
     * Return the bitmap with the specified color.
     *
     * @param src   The source of bitmap.
     * @param color The color.
     * @return the bitmap with the specified color
     */
    Bitmap drawColor(@NonNull final Bitmap src, @ColorInt final int color);

    /**
     * Return the bitmap with the specified color.
     *
     * @param src     The source of bitmap.
     * @param color   The color.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the bitmap with the specified color
     */
    Bitmap drawColor(@NonNull final Bitmap src,
                     @ColorInt final int color,
                     final boolean recycle);

    /**
     * Return the scaled bitmap.
     *
     * @param src       The source of bitmap.
     * @param newWidth  The new width.
     * @param newHeight The new height.
     * @return the scaled bitmap
     */
    Bitmap scale(final Bitmap src, final int newWidth, final int newHeight);

    /**
     * Return the scaled bitmap.
     *
     * @param src       The source of bitmap.
     * @param newWidth  The new width.
     * @param newHeight The new height.
     * @param recycle   True to recycle the source of bitmap, false otherwise.
     * @return the scaled bitmap
     */
    Bitmap scale(final Bitmap src,
                 final int newWidth,
                 final int newHeight,
                 final boolean recycle);

    /**
     * Return the scaled bitmap
     *
     * @param src         The source of bitmap.
     * @param scaleWidth  The scale of width.
     * @param scaleHeight The scale of height.
     * @return the scaled bitmap
     */
    Bitmap scale(final Bitmap src, final float scaleWidth, final float scaleHeight);

    /**
     * Return the scaled bitmap
     *
     * @param src         The source of bitmap.
     * @param scaleWidth  The scale of width.
     * @param scaleHeight The scale of height.
     * @param recycle     True to recycle the source of bitmap, false otherwise.
     * @return the scaled bitmap
     */
    Bitmap scale(final Bitmap src,
                 final float scaleWidth,
                 final float scaleHeight,
                 final boolean recycle);

    /**
     * Return the clipped bitmap.
     *
     * @param src    The source of bitmap.
     * @param x      The x coordinate of the first pixel.
     * @param y      The y coordinate of the first pixel.
     * @param width  The width.
     * @param height The height.
     * @return the clipped bitmap
     */
    Bitmap clip(final Bitmap src,
                final int x,
                final int y,
                final int width,
                final int height);

    /**
     * Return the clipped bitmap.
     *
     * @param src     The source of bitmap.
     * @param x       The x coordinate of the first pixel.
     * @param y       The y coordinate of the first pixel.
     * @param width   The width.
     * @param height  The height.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the clipped bitmap
     */
    Bitmap clip(final Bitmap src,
                final int x,
                final int y,
                final int width,
                final int height,
                final boolean recycle);

    /**
     * Return the skewed bitmap.
     *
     * @param src The source of bitmap.
     * @param kx  The skew factor of x.
     * @param ky  The skew factor of y.
     * @return the skewed bitmap
     */
    Bitmap skew(final Bitmap src, final float kx, final float ky);

    /**
     * Return the skewed bitmap.
     *
     * @param src     The source of bitmap.
     * @param kx      The skew factor of x.
     * @param ky      The skew factor of y.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the skewed bitmap
     */
    Bitmap skew(final Bitmap src,
                final float kx,
                final float ky,
                final boolean recycle);

    /**
     * Return the skewed bitmap.
     *
     * @param src The source of bitmap.
     * @param kx  The skew factor of x.
     * @param ky  The skew factor of y.
     * @param px  The x coordinate of the pivot point.
     * @param py  The y coordinate of the pivot point.
     * @return the skewed bitmap
     */
    Bitmap skew(final Bitmap src,
                final float kx,
                final float ky,
                final float px,
                final float py);

    /**
     * Return the skewed bitmap.
     *
     * @param src     The source of bitmap.
     * @param kx      The skew factor of x.
     * @param ky      The skew factor of y.
     * @param px      The x coordinate of the pivot point.
     * @param py      The y coordinate of the pivot point.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the skewed bitmap
     */
    Bitmap skew(final Bitmap src,
                final float kx,
                final float ky,
                final float px,
                final float py,
                final boolean recycle);

    /**
     * Return the rotated bitmap.
     *
     * @param src     The source of bitmap.
     * @param degrees The number of degrees.
     * @param px      The x coordinate of the pivot point.
     * @param py      The y coordinate of the pivot point.
     * @return the rotated bitmap
     */
    Bitmap rotate(final Bitmap src,
                  final int degrees,
                  final float px,
                  final float py);

    /**
     * Return the rotated bitmap.
     *
     * @param src     The source of bitmap.
     * @param degrees The number of degrees.
     * @param px      The x coordinate of the pivot point.
     * @param py      The y coordinate of the pivot point.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the rotated bitmap
     */
    Bitmap rotate(final Bitmap src,
                  final int degrees,
                  final float px,
                  final float py,
                  final boolean recycle);

    /**
     * Return the rotated degree.
     *
     * @param filePath The path of file.
     * @return the rotated degree
     */
    int getRotateDegree(final String filePath);

    /**
     * Return the round bitmap.
     *
     * @param src The source of bitmap.
     * @return the round bitmap
     */
    Bitmap toRound(final Bitmap src);

    /**
     * Return the round bitmap.
     *
     * @param src     The source of bitmap.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the round bitmap
     */
    Bitmap toRound(final Bitmap src, final boolean recycle);

    /**
     * Return the round bitmap.
     *
     * @param src         The source of bitmap.
     * @param borderSize  The size of border.
     * @param borderColor The color of border.
     * @return the round bitmap
     */
    Bitmap toRound(final Bitmap src,
                   @IntRange(from = 0) int borderSize,
                   @ColorInt int borderColor);

    /**
     * Return the round bitmap.
     *
     * @param src         The source of bitmap.
     * @param recycle     True to recycle the source of bitmap, false otherwise.
     * @param borderSize  The size of border.
     * @param borderColor The color of border.
     * @return the round bitmap
     */
    Bitmap toRound(final Bitmap src,
                   @IntRange(from = 0) int borderSize,
                   @ColorInt int borderColor,
                   final boolean recycle);

    /**
     * Return the round corner bitmap.
     *
     * @param src    The source of bitmap.
     * @param radius The radius of corner.
     * @return the round corner bitmap
     */
    Bitmap toRoundCorner(final Bitmap src, final float radius);

    /**
     * Return the round corner bitmap.
     *
     * @param src     The source of bitmap.
     * @param radius  The radius of corner.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the round corner bitmap
     */
    Bitmap toRoundCorner(final Bitmap src,
                         final float radius,
                         final boolean recycle);

    /**
     * Return the round corner bitmap.
     *
     * @param src         The source of bitmap.
     * @param radius      The radius of corner.
     * @param borderSize  The size of border.
     * @param borderColor The color of border.
     * @return the round corner bitmap
     */
    Bitmap toRoundCorner(final Bitmap src,
                         final float radius,
                         @IntRange(from = 0) int borderSize,
                         @ColorInt int borderColor);

    /**
     * Return the round corner bitmap.
     *
     * @param src         The source of bitmap.
     * @param radius      The radius of corner.
     * @param borderSize  The size of border.
     * @param borderColor The color of border.
     * @param recycle     True to recycle the source of bitmap, false otherwise.
     * @return the round corner bitmap
     */
    Bitmap toRoundCorner(final Bitmap src,
                         final float radius,
                         @IntRange(from = 0) int borderSize,
                         @ColorInt int borderColor,
                         final boolean recycle);

    /**
     * Return the round corner bitmap with border.
     *
     * @param src          The source of bitmap.
     * @param borderSize   The size of border.
     * @param color        The color of border.
     * @param cornerRadius The radius of corner.
     * @return the round corner bitmap with border
     */
    Bitmap addCornerBorder(final Bitmap src,
                           @IntRange(from = 1) final int borderSize,
                           @ColorInt final int color,
                           @FloatRange(from = 0) final float cornerRadius);

    /**
     * Return the round corner bitmap with border.
     *
     * @param src          The source of bitmap.
     * @param borderSize   The size of border.
     * @param color        The color of border.
     * @param cornerRadius The radius of corner.
     * @param recycle      True to recycle the source of bitmap, false otherwise.
     * @return the round corner bitmap with border
     */
    Bitmap addCornerBorder(final Bitmap src,
                           @IntRange(from = 1) final int borderSize,
                           @ColorInt final int color,
                           @FloatRange(from = 0) final float cornerRadius,
                           final boolean recycle);

    /**
     * Return the round bitmap with border.
     *
     * @param src        The source of bitmap.
     * @param borderSize The size of border.
     * @param color      The color of border.
     * @return the round bitmap with border
     */
    Bitmap addCircleBorder(final Bitmap src,
                           @IntRange(from = 1) final int borderSize,
                           @ColorInt final int color);

    /**
     * Return the round bitmap with border.
     *
     * @param src        The source of bitmap.
     * @param borderSize The size of border.
     * @param color      The color of border.
     * @param recycle    True to recycle the source of bitmap, false otherwise.
     * @return the round bitmap with border
     */
    Bitmap addCircleBorder(final Bitmap src,
                           @IntRange(from = 1) final int borderSize,
                           @ColorInt final int color,
                           final boolean recycle);

    /**
     * Return the bitmap with reflection.
     *
     * @param src              The source of bitmap.
     * @param reflectionHeight The height of reflection.
     * @return the bitmap with reflection
     */
    Bitmap addReflection(final Bitmap src, final int reflectionHeight);

    /**
     * Return the bitmap with reflection.
     *
     * @param src              The source of bitmap.
     * @param reflectionHeight The height of reflection.
     * @param recycle          True to recycle the source of bitmap, false otherwise.
     * @return the bitmap with reflection
     */
    Bitmap addReflection(final Bitmap src,
                         final int reflectionHeight,
                         final boolean recycle);

    /**
     * Return the bitmap with text watermarking.
     *
     * @param src      The source of bitmap.
     * @param content  The content of text.
     * @param textSize The size of text.
     * @param color    The color of text.
     * @param x        The x coordinate of the first pixel.
     * @param y        The y coordinate of the first pixel.
     * @return the bitmap with text watermarking
     */
    Bitmap addTextWatermark(final Bitmap src,
                            final String content,
                            final int textSize,
                            @ColorInt final int color,
                            final float x,
                            final float y);

    /**
     * Return the bitmap with text watermarking.
     *
     * @param src      The source of bitmap.
     * @param content  The content of text.
     * @param textSize The size of text.
     * @param color    The color of text.
     * @param x        The x coordinate of the first pixel.
     * @param y        The y coordinate of the first pixel.
     * @param recycle  True to recycle the source of bitmap, false otherwise.
     * @return the bitmap with text watermarking
     */
    Bitmap addTextWatermark(final Bitmap src,
                            final String content,
                            final float textSize,
                            @ColorInt final int color,
                            final float x,
                            final float y,
                            final boolean recycle);

    /**
     * Return the bitmap with image watermarking.
     *
     * @param src       The source of bitmap.
     * @param watermark The image watermarking.
     * @param x         The x coordinate of the first pixel.
     * @param y         The y coordinate of the first pixel.
     * @param alpha     The alpha of watermark.
     * @return the bitmap with image watermarking
     */
    Bitmap addImageWatermark(final Bitmap src,
                             final Bitmap watermark,
                             final int x, final int y,
                             final int alpha);

    /**
     * Return the bitmap with image watermarking.
     *
     * @param src       The source of bitmap.
     * @param watermark The image watermarking.
     * @param x         The x coordinate of the first pixel.
     * @param y         The y coordinate of the first pixel.
     * @param alpha     The alpha of watermark.
     * @param recycle   True to recycle the source of bitmap, false otherwise.
     * @return the bitmap with image watermarking
     */
    Bitmap addImageWatermark(final Bitmap src,
                             final Bitmap watermark,
                             final int x,
                             final int y,
                             final int alpha,
                             final boolean recycle);

    /**
     * Return the alpha bitmap.
     *
     * @param src The source of bitmap.
     * @return the alpha bitmap
     */
    Bitmap toAlpha(final Bitmap src);

    /**
     * Return the alpha bitmap.
     *
     * @param src     The source of bitmap.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the alpha bitmap
     */
    Bitmap toAlpha(final Bitmap src, final Boolean recycle);

    /**
     * Return the gray bitmap.
     *
     * @param src The source of bitmap.
     * @return the gray bitmap
     */
    Bitmap toGray(final Bitmap src);

    /**
     * Return the gray bitmap.
     *
     * @param src     The source of bitmap.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the gray bitmap
     */
    Bitmap toGray(final Bitmap src, final boolean recycle);

    /**
     * Return the blur bitmap fast.
     * <p>zoom out, blur, zoom in</p>
     *
     * @param src    The source of bitmap.
     * @param scale  The scale(0...1).
     * @param radius The radius(0...25).
     * @return the blur bitmap
     */
    Bitmap fastBlur(final Bitmap src,
                    @FloatRange(
                            from = 0, to = 1, fromInclusive = false
                    ) final float scale,
                    @FloatRange(
                            from = 0, to = 25, fromInclusive = false
                    ) final float radius);

    /**
     * Return the blur bitmap fast.
     * <p>zoom out, blur, zoom in</p>
     *
     * @param src    The source of bitmap.
     * @param scale  The scale(0...1).
     * @param radius The radius(0...25).
     * @return the blur bitmap
     */
    Bitmap fastBlur(final Bitmap src,
                    @FloatRange(
                            from = 0, to = 1, fromInclusive = false
                    ) final float scale,
                    @FloatRange(
                            from = 0, to = 25, fromInclusive = false
                    ) final float radius,
                    final boolean recycle);

    /**
     * Return the blur bitmap fast.
     * <p>zoom out, blur, zoom in</p>
     *
     * @param src           The source of bitmap.
     * @param scale         The scale(0...1).
     * @param radius        The radius(0...25).
     * @param recycle       True to recycle the source of bitmap, false otherwise.
     * @param isReturnScale True to return the scale blur bitmap, false otherwise.
     * @return the blur bitmap
     */
    Bitmap fastBlur(final Bitmap src,
                    @FloatRange(
                            from = 0, to = 1, fromInclusive = false
                    ) final float scale,
                    @FloatRange(
                            from = 0, to = 25, fromInclusive = false
                    ) final float radius,
                    final boolean recycle,
                    final boolean isReturnScale);

    /**
     * Return the blur bitmap using render script.
     *
     * @param src    The source of bitmap.
     * @param radius The radius(0...25).
     * @return the blur bitmap
     */
    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    Bitmap renderScriptBlur(final Bitmap src,
                            @FloatRange(
                                    from = 0, to = 25, fromInclusive = false
                            ) final float radius);

    /**
     * Return the blur bitmap using render script.
     *
     * @param src     The source of bitmap.
     * @param radius  The radius(0...25).
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the blur bitmap
     */
    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    Bitmap renderScriptBlur(final Bitmap src,
                            @FloatRange(
                                    from = 0, to = 25, fromInclusive = false
                            ) final float radius,
                            final boolean recycle);

    /**
     * Return the blur bitmap using stack.
     *
     * @param src    The source of bitmap.
     * @param radius The radius(0...25).
     * @return the blur bitmap
     */
    Bitmap stackBlur(final Bitmap src, final int radius);

    /**
     * Return the blur bitmap using stack.
     *
     * @param src     The source of bitmap.
     * @param radius  The radius(0...25).
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the blur bitmap
     */
    Bitmap stackBlur(final Bitmap src, int radius, final boolean recycle);

    /**
     * Save the bitmap.
     *
     * @param src      The source of bitmap.
     * @param filePath The path of file.
     * @param format   The format of the image.
     * @return {@code true}: success<br>{@code false}: fail
     */
    boolean save(final Bitmap src,
                 final String filePath,
                 final Bitmap.CompressFormat format);

    /**
     * Save the bitmap.
     *
     * @param src    The source of bitmap.
     * @param file   The file.
     * @param format The format of the image.
     * @return {@code true}: success<br>{@code false}: fail
     */
    boolean save(final Bitmap src, final File file, final Bitmap.CompressFormat format);

    /**
     * Save the bitmap.
     *
     * @param src      The source of bitmap.
     * @param filePath The path of file.
     * @param format   The format of the image.
     * @param recycle  True to recycle the source of bitmap, false otherwise.
     * @return {@code true}: success<br>{@code false}: fail
     */
    boolean save(final Bitmap src,
                 final String filePath,
                 final Bitmap.CompressFormat format,
                 final boolean recycle);

    /**
     * Save the bitmap.
     *
     * @param src     The source of bitmap.
     * @param file    The file.
     * @param format  The format of the image.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return {@code true}: success<br>{@code false}: fail
     */
    boolean save(final Bitmap src,
                 final File file,
                 final Bitmap.CompressFormat format,
                 final boolean recycle);

    /**
     * Return whether it is a image according to the file name.
     *
     * @param file The file.
     * @return {@code true}: yes<br>{@code false}: no
     */
    boolean isImage(final File file);

    /**
     * Return whether it is a image according to the file name.
     *
     * @param filePath The path of file.
     * @return {@code true}: yes<br>{@code false}: no
     */
    boolean isImage(final String filePath);

    /**
     * Return the type of image.
     *
     * @param filePath The path of file.
     * @return the type of image
     */
    String getImageType(final String filePath);

    /**
     * Return the type of image.
     *
     * @param file The file.
     * @return the type of image
     */
    String getImageType(final File file);


    ///////////////////////////////////////////////////////////////////////////
    // about compress
    ///////////////////////////////////////////////////////////////////////////

    /**
     * Return the compressed bitmap using scale.
     *
     * @param src       The source of bitmap.
     * @param newWidth  The new width.
     * @param newHeight The new height.
     * @return the compressed bitmap
     */
    Bitmap compressByScale(final Bitmap src,
                           final int newWidth,
                           final int newHeight);

    /**
     * Return the compressed bitmap using scale.
     *
     * @param src       The source of bitmap.
     * @param newWidth  The new width.
     * @param newHeight The new height.
     * @param recycle   True to recycle the source of bitmap, false otherwise.
     * @return the compressed bitmap
     */
    Bitmap compressByScale(final Bitmap src,
                           final int newWidth,
                           final int newHeight,
                           final boolean recycle);

    /**
     * Return the compressed bitmap using scale.
     *
     * @param src         The source of bitmap.
     * @param scaleWidth  The scale of width.
     * @param scaleHeight The scale of height.
     * @return the compressed bitmap
     */
    Bitmap compressByScale(final Bitmap src,
                           final float scaleWidth,
                           final float scaleHeight);

    /**
     * Return the compressed bitmap using scale.
     *
     * @param src         The source of bitmap.
     * @param scaleWidth  The scale of width.
     * @param scaleHeight The scale of height.
     * @param recycle     True to recycle the source of bitmap, false otherwise.
     * @return he compressed bitmap
     */
    Bitmap compressByScale(final Bitmap src,
                           final float scaleWidth,
                           final float scaleHeight,
                           final boolean recycle);

    /**
     * Return the compressed bitmap using quality.
     *
     * @param src     The source of bitmap.
     * @param quality The quality.
     * @return the compressed bitmap
     */
    Bitmap compressByQuality(final Bitmap src,
                             @IntRange(from = 0, to = 100) final int quality);

    /**
     * Return the compressed bitmap using quality.
     *
     * @param src     The source of bitmap.
     * @param quality The quality.
     * @param recycle True to recycle the source of bitmap, false otherwise.
     * @return the compressed bitmap
     */
    Bitmap compressByQuality(final Bitmap src,
                             @IntRange(from = 0, to = 100) final int quality,
                             final boolean recycle);

    /**
     * Return the compressed bitmap using quality.
     *
     * @param src         The source of bitmap.
     * @param maxByteSize The maximum size of byte.
     * @return the compressed bitmap
     */
    Bitmap compressByQuality(final Bitmap src, final long maxByteSize);

    /**
     * Return the compressed bitmap using quality.
     *
     * @param src         The source of bitmap.
     * @param maxByteSize The maximum size of byte.
     * @param recycle     True to recycle the source of bitmap, false otherwise.
     * @return the compressed bitmap
     */
    Bitmap compressByQuality(final Bitmap src,
                             final long maxByteSize,
                             final boolean recycle);

    /**
     * Return the compressed bitmap using sample size.
     *
     * @param src        The source of bitmap.
     * @param sampleSize The sample size.
     * @return the compressed bitmap
     */

    Bitmap compressBySampleSize(final Bitmap src, final int sampleSize);

    /**
     * Return the compressed bitmap using sample size.
     *
     * @param src        The source of bitmap.
     * @param sampleSize The sample size.
     * @param recycle    True to recycle the source of bitmap, false otherwise.
     * @return the compressed bitmap
     */
    Bitmap compressBySampleSize(final Bitmap src,
                                final int sampleSize,
                                final boolean recycle);

    /**
     * Return the compressed bitmap using sample size.
     *
     * @param src       The source of bitmap.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @return the compressed bitmap
     */
    Bitmap compressBySampleSize(final Bitmap src,
                                final int maxWidth,
                                final int maxHeight);

    /**
     * Return the compressed bitmap using sample size.
     *
     * @param src       The source of bitmap.
     * @param maxWidth  The maximum width.
     * @param maxHeight The maximum height.
     * @param recycle   True to recycle the source of bitmap, false otherwise.
     * @return the compressed bitmap
     */
    Bitmap compressBySampleSize(final Bitmap src,
                                final int maxWidth,
                                final int maxHeight,
                                final boolean recycle);

    /**
     * Return the size of bitmap.
     *
     * @param filePath The path of file.
     * @return the size of bitmap
     */
    int[] getSize(String filePath);

    /**
     * Return the size of bitmap.
     *
     * @param file The file.
     * @return the size of bitmap
     */
    int[] getSize(File file);


}
